package com.bootmagic;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/***
 * application enter point
 *
 * @author feilong
 * @version 1.0
 * @since 2024/6-17
 */
@Slf4j
@SpringBootApplication
public class Application {

    private static final String APPLICATION_NAME = "springboot-thirdlogin";

    private static final String SERVER_PORT_CONFIG_KEY = "server.port";


    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext =
                new SpringApplicationBuilder().logStartupInfo(false)
                        .sources(Application.class).run(args);
        ConfigurableEnvironment configurableEnvironment =
                applicationContext.getEnvironment();
        if (log.isInfoEnabled()) {
            String serverPort = configurableEnvironment.getProperty(SERVER_PORT_CONFIG_KEY);
            log.info("{} start success,visit port:{}", APPLICATION_NAME, serverPort);
        }
    }
}
